<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        #box{
            width: 500px;
            height: 100px;
            border: 2px solid rosybrown;
        }
    </style>
</head>
<body>
    <input type="text">&nbsp;
    <button id="btn">复制</button>
    <div id="box"> 
    </div>
    <button onclick="start()">点击获取快乐</button><br>
    <span id="sp"></span>
    <script>
        var btn = document.getElementById('btn')
        var box = document.getElementById('box');
        btn.onclick=function (){
            var str = document.querySelector('input')
            var str1 =  document.getElementById('box').innerText
            str1 =str.value;
            var newNode = document.createElement('h2');
            var newTextNode = document.createTextNode(str1);
            newNode.appendChild(newTextNode);
            box.appendChild(newNode);
        }
        dj = 0
        function start(){
            dj++;
            console.log(dj);
            document.getElementById('sp').innerText="封校三天 快乐无边"
            if (dj%2==0) {
                document.getElementById('sp').innerText=""
            }
        }
    </script>
</body>
</html>